﻿using AutoMapper;
using ClothingShopping.Dto;
using ClothingShopping.Dto.AccountDto;
using ClothingShopping.IService;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace ClothingShop.Login.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class AccountController : ControllerBase
    {
        #region Fields
        private readonly IUserService _userService;
        #endregion

        #region Ctors
        public AccountController(IUserService userService)
        {
            _userService = userService;
        }
        #endregion

        [HttpPost]
        [AllowAnonymous]
        public async Task<IResultOutput> Login(LoginInDto loginInDto)
        {
            var token=await _userService.LoginAsync(loginInDto.login_name, loginInDto.pwd);
            return token;
        }
    }


}
